<?php

class FavoritesResource extends BaseResource
{
    public function get()
    {
        $favs = $this->user->favorites->all();
        $this->responds($favs, 200);
    }
    
    public function post()
    {
        $fav = new Favorite();
        $fav->status_id = $this->params['status_id'];
        $fav->user_id = $this->user->id;
        if ($fav->save())
            $this->responds_created($fav, 201);
        else
            $this->responds_detailed_error($fav->errors, 400);
    }
}

?>